package com.zdyumath.springboot;

import com.zdyumath.springboot.service.IUserService;
import com.zdyumath.springboot.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class  SpringbootApplication {

    public static void main(String[] args) {
        // spring容器, 当前类当做配置类， @SpringBootApplication的源注解就有@Configuration和@ComponentScan
        // 其中, @ComponentScan在没有写basePackages扫描包时，会把当前类所在包当做扫描包
        // run方法底层会创建一个spring容器
        ConfigurableApplicationContext ioc = SpringApplication.run(SpringbootApplication.class, args);
        IUserService userService = ioc.getBean(IUserService.class);
        userService.getUser();
    }

}
